package com.house.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.house.entity.Menu;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MenuMapper extends BaseMapper<Menu> {

    List<Menu> selectMensByRole();

    @Select("select " +
            "menu_id, parent_id, menu_name, route_name, menu_status, description, icon, sort, create_time, update_time " +
            "from menu order by sort asc")
    List<Menu> selectMens();

    @Select("select " +
            "menu_id, parent_id, menu_name, route_name, menu_status, description, sort, icon, create_user, update_user " +
            "from menu where menu_id = #{menuId}")
    Menu selectByMenuId(int menuId);


    @Delete("delete from menu where menu_id = #{menuId}")
    int delete(int menuId);
}
